/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package graphics.player;

/**
 *
 * @author Yole
 */

import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class SpaceShip extends JLabel {

    int [] pos = new int[2];
    private int height;
    private int width;

    public SpaceShip() {

        height = 148;
        width = 288;
        pos[0] = 0;
        pos[1] = 0;
        this.setBounds(pos[0], pos[1], width, height);
        this.setIcon(createImageIcon("sship.jpg"));
        this.setVisible(true);

    }
    
    public int [] getPos() {

        return pos;

    }

    public void setPos( int x, int y ) {

        pos[0] = x;
        pos[1] = y;
        this.setBounds(pos[0], pos[1], getWidth(), getHeight());

    }

    public void moveHoriz( int x ) {

       pos[0] += x;
       this.setBounds(pos[0], pos[1], getWidth(), getHeight());

    }

    public void moveVert( int y ) {

       pos[1] += y;
       this.setBounds(pos[0], pos[1], getWidth(), getHeight());

    }

    protected ImageIcon createImageIcon(String path) {

        java.net.URL imgURL = getClass().getResource(path);
        if (imgURL != null) {
            return new ImageIcon(imgURL);
        } else {
            System.err.println("Couldn't find file: " + path);
            return null;
        }
    }

    /**
     * @return the height
     */
    @Override
    public int getHeight() {
        return height;
    }

    /**
     * @return the width
     */
    @Override
    public int getWidth() {
        return width;
    }


}
